-
Notifications
You must be signed in to change notification settings - Fork 3
Ensure sized on associated methods #6
Ensure sized on associated methods #6
Conversation
32ff8c2
to
345a358
Compare
Everything looks good to me. Just one thing:
I don't have any problem with this, but if both |
@cjhowe7 Happy to revert the last commit so this could be unlocked and eventually revisit it later. |
This reverts commit 345a358.
btw checking https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-path-dependencies looks like it would eventually be possible defining a So it should be something like
it will require some synchronisation as |
@cjhowe7 any update on this? |
Oh my bad, I forgot about this. Just tested this locally, I think everything looks good. Merging now. |
No problem :) thanks a lot for merging it |
Published in https://crates.io/crates/named_type/0.2.0 |
Associated methods needs to be available only for
Sized
implementations.As far as I can tell this is a common pattern for traits that adds associated methods to structs (ie. Default, From, etc.)
The main rationale of this change is to allow
NamedType
derived structs to be stored into structures likeVec<Box<a_trait_name>>
The added test case would fail to compile if the changes into
named_type/src/lib.rs
would be reverted, in such way we can prevent eventual regressions.I've also added
named_type_derive
dependency innamed_type
such that users of this crate will need to only addnamed_type
dependency in cargo.Without doing that users were forced to use
named_type
andnamed_type_derive
and to ensure that both were defined with the same version.